package com.fly.springbootTemplate.serviceImpl;

import com.fly.springbootTemplate.dao.AdminDao;
import com.fly.springbootTemplate.entity.Admin;
import com.fly.springbootTemplate.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminDao adminDao;
    @Override
    public boolean insertAdmin(Admin admin) {
        return adminDao.insertAdmin(admin);
    }

    @Override
    public boolean deleteAdmin(Integer id) {
        return adminDao.deleteAdmin(id);
    }

    @Override
    public boolean updateAdmin(Admin admin) {
        return adminDao.updateAdmin(admin);
    }

    @Override
    public Admin getAdminById(Integer id) {
        return adminDao.queryAdminById(id);
    }

    @Override
    public List<Admin> getAllAdmin() {
        return adminDao.queryAllAdmin();
    }

    @Override
    public boolean verifyPassword(String name, String password) {
        return adminDao.verifyPassword(name, password)>0;
    }
}
